package com.wuchao.springandmybatis;

import com.wuchao.mapper.UserMapper;
import com.wuchao.service.UserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Arrays;

/**
 * @Author wuchao66
 * @Date 2022/7/5 10:16
 * @Version 1.0
 */
public class Test1 {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext cpac =
                new ClassPathXmlApplicationContext("ApplicationContextPlus.xml");
        //ShowSpringAndMybatis showSpringAndMybatis=  (ShowSpringAndMybatis)cpac.getBean("ShowSpringAndMybatis");
       // showSpringAndMybatis.showUserList().forEach(System.out::println);
       // showSpringAndMybatis.show();
      /*  System.out.println("...............");
        UserMapper userMapper=(UserMapper)cpac.getBean("UserMapper");
        userMapper.findUserList().forEach(System.out::println);
        //查看多少扫描成功的bean
        String[] beanDefinitionNames = cpac.getBeanDefinitionNames();
        Arrays.asList(beanDefinitionNames).forEach(xjj-> System.out.println(xjj));*/
        /*事务*/
        Tranc t =    (Tranc)cpac.getBean("Tranc");
        t.show();
      /*  ShowSpringAndMybatis t1 =    (ShowSpringAndMybatis)cpac.getBean("ShowSpringAndMybatis");
        t1.show();*/
    }
}
